package com.itheima.tliasmanager.controller;

import com.itheima.tliasmanager.pojo.dto.GenderCount;
import com.itheima.tliasmanager.pojo.vo.JobVo;
import com.itheima.tliasmanager.pojo.vo.Result;
import com.itheima.tliasmanager.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 员工职位统计
     */
    @GetMapping("/empJobData")
    public Result empJobReport(){
        //1.接收请求参数：无

        //2.调用service业务方法，获取职位统计结果
        JobVo jobVo = reportService.empJobReport();

        //3.封装并返回结果数据
        return Result.success(jobVo); //code=1,msg='success',data=jobVo
    }


    /**
     * 员工性别统计
     */
    @GetMapping("/empGenderData")
    public  Result empGenderReport(){
        //1.接收请求参数：无

        //2.调用service业务方法，获取性别统计结果
        List<GenderCount> genderCountList = reportService.empGenderReport();

        //3.封装并返回结果数据
        return Result.success(genderCountList); //code=1,msg='success',data=List
    }


}
